]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
popupMenu: Don't handle key presses directly if there are modifiers
authorAndrea Azzarone <andrea.azzarone@canonical.com>
Thu, 21 Jun 2018 16:40:43 +0000 (18:40 +0200)
committerAndrea Azzarone <azzaronea@gmail.com>
Sat, 14 Jul 2018 12:04:18 +0000 (14:04 +0200)
Key events involved in a keyboard shortcut are not completely consumed by
Mutter. That means that if the popupMenu is bound to a shortcut (e.g.
Alt<Space>) and the user keeps the keys pressed, the same key-event will be
delivered to the popupMenu. We can workaround this issue filtering out all the
events where a a modifier is down (except capslock).

Fixes: https://gitlab.gnome.org/GNOME/gnome-shell/issues/372
js/ui/popupMenu.js

index 83194d72ba7b69cf28d5a6be6370d7a447d3e6ac..f449d6e7e994c481db056685000d8283c1955e88 100644 (file)
@@ -141,8 +141,17 @@ var PopupBaseMenuItem = new Lang.Class({
     },
 
     _onKeyPressEvent(actor, event) {
-        let symbol = event.get_key_symbol();
+        let state = event.get_state();
 
+        // if user has a modifier down (except capslock)
+        // then don't handle the key press here
+        state &= ~Clutter.ModifierType.LOCK_MASK;
+        state &= Clutter.ModifierType.MODIFIER_MASK;
+
+        if (state)
+            return Clutter.EVENT_PROPAGATE;
+
+        let symbol = event.get_key_symbol();
         if (symbol == Clutter.KEY_space || symbol == Clutter.KEY_Return) {
             this.activate(event);
             return Clutter.EVENT_STOP;